package com.jhgk.jhcee.system.controller;

import com.jhgk.jhcee.common.resultful.BasisResultful;
import com.jhgk.jhcee.system.domain.model.SysOrgInfoModel;
import com.jhgk.jhcee.system.service.SysOrgInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description:
 * @Author: lemon_xzp
 * @Date: 2021/9/23 7:59
 */
@RestController
@RequestMapping("/org")
@Api(value = "组织信息", tags = {"组织信息"})
public class SysOrgInfoController {

    @Resource(name = "SysOrgInfoServiceImpl")
    SysOrgInfoService sysOrgInfoService;

    @PostMapping("/getOrgList")
    @ApiOperation("分页获取所有组织信息")
    public BasisResultful<Object> getOrgList(@RequestBody SysOrgInfoModel model) {
        return sysOrgInfoService.getOrgAllListPage(model);
    }

    @GetMapping("/getOrgListAll")
    @ApiOperation("获取所有组织信息")
    public BasisResultful<Object> getOrgListAll() {
        return sysOrgInfoService.getAllList();
    }

    @PostMapping("/addOrg")
    @ApiOperation("新增组织信息")
    public BasisResultful<Object> addOrg(@RequestBody SysOrgInfoModel model) {
        return sysOrgInfoService.addOrg(model);
    }

    @PutMapping("/updateOrg")
    @ApiOperation("更新组织信息")
    public BasisResultful<Object> updateOrg(@RequestBody SysOrgInfoModel model) {
        return sysOrgInfoService.updateOrg(model);
    }

    @DeleteMapping("/deleteOrg")
    @ApiOperation("删除组织信息")
    public BasisResultful<Object> deleteOrg(@RequestBody SysOrgInfoModel model) {
        return sysOrgInfoService.deleteOrg(model);
    }

    @PutMapping("/updateStatus")
    @ApiOperation("更新组织状态信息")
    public BasisResultful<Object> updateStatus(@RequestParam("orgId")Long orgId,@RequestParam("status")Integer status) {
        return sysOrgInfoService.updateStatus(orgId,status);
    }
}
